<?php
/**
 * @Copyright Copyright (C) 2010-2012
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 + Created by:          Webit Solution
 * Company:		Webit Solution
 + Contact:		www.webits.asia, developer@webits.asia
 * Created on:	Mar 21, 2012
 ^
 + Project: 		WRecruit
 * File Name:	views/jobseeker/tmpl/controlpanel.php
 ^ 
 * Description: template view for control panel
 ^ 
 * History:		NONE
 ^ 
 */
 
 defined('_JEXEC') or die('Restricted access');
  global $mainframe;
  $document =& JFactory::getDocument();
   $document->addStyleSheet('components/com_wrecruit/css/'.$this->config['theme']);
$comma = 0;
$colperrow=2;
$colwidth = round(100/$colperrow,1);
$colwidth = $colwidth.'%';

?>
<?php if ($this->config['offline'] == '1'){ ?>
<table cellpadding="0" cellspacing="0" border="0" width="100%" >
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	<?php echo $this->config['title']; ?></td></tr>
	<tr><td height="25"></td></tr>
	<tr><td class="wrecruitmsg">
		<?php echo $this->config['offline_text']; ?>
	</td></tr>
</table>	
<?php }else{ ?>

<table cellpadding="0" cellspacing="0" border="0" width="100%" >
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	
		<?php echo $this->config['title']; ?>
	</td>
	</tr>
	<tr><td height="23"></td></tr>
	<?php if ($this->config['cur_location'] == 1) {?>
	<tr><td height="0"></td></tr>
	<tr><td class="curloc">
		<?php echo JText::_('JS_CUR_LOC'); ?> : <?php echo JText::_('JS_JOB_SEEKER_C_P'); ?>
	</td></tr>
	<?php } ?>
	<tr><td>
		<?php 
		if (sizeof($this->jobseekerlinks) != 0){
			echo '<div id="toplinks"><ul>';
			foreach($this->jobseekerlinks as $lnk)	{ ?>
					<span <?php if($lnk[2] == 1)echo 'class="first"'; elseif($lnk[2] == -1)echo 'class="last"';  ?>>
					<a href="<?php echo $lnk[0]; ?>"> <?php echo $lnk[1]; ?></a>
				</span>
			<?php }
			echo '<ul></div>';			
		} 
		?>
	</td></tr>	
	<tr><td height="3"></td></tr>
	
	<tr><td class="<?php echo $this->theme['heading']; ?>" align="center">
		<?php echo JText::_('JS_JOB_SEEKER_C_P'); ?> 
	</td></tr>

	<tr><td height="10"></td></tr>
</table>

<?php

if (isset($this->userrole->rolefor)){
	if ($this->userrole->rolefor != ''){
		if ($this->userrole->rolefor == 2) // job seeker
			$allowed = true;
		else
			$allowed = false;
	}else{
		$allowed = true;
	}
}else $allowed = true; // user not logined
if ($allowed == true) { 
?>

	<table cellpadding="0" cellspacing="0" border="0" width="100%" >
		<tr>
			<td>
				<table cellpadding="0" cellspacing="0" border="0" width="100%" >
					<tr height="15">
						<td width="250"></td>
						<td>  </td>
					</tr>
				</table>
			</td>
		</tr>	
		<tr>
			<td>
				<table cellpadding="0" cellspacing="0" border="0" width="100%" >
					<tr>
						<td width="47%" valign="top">
							<table cellpadding="0" cellspacing="0" border="0" width="100%" >
							<?php if ($this->jscontrolpanel['formresume'] == 1) {
								$colcount=0;?>
								<tr>
									<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img align="left" width="24" height="24" src="components/com_wrecruit/images/new.png" alt="<?php echo JText::_('JS_ADD_RESUME'); ?>" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=formresume&vm=2&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_ADD_RESUME'); ?>  </a>
									<?php echo '</td>'?>
							<?php } ?>
							<?php if ($this->jscontrolpanel['jobcat'] == 1) { ?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img align="left" width="24" height="24" src="components/com_wrecruit/images/jobcat.png" alt="<?php echo JText::_('JS_JOBS_BY_CATEGORIES'); ?>" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=jobcat&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_JOBS_BY_CATEGORIES'); ?>  </a>
									<?php echo '</td>'?>
							<?php } 
							 if ($this->jscontrolpanel['myresumes'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img align="left" width="24" height="24" src="components/com_wrecruit/images/resume.png" alt="<?php echo JText::_('JS_MY_RESUMES'); ?>" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=myresumes&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_MY_RESUMES'); ?> </a> 
									<?php echo '</td>'?>
							<?php } ?>
							 <?php if ($this->jscontrolpanel['listnewestjobs'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img align="left" width="24" height="24" src="components/com_wrecruit/images/newestjobs.png" alt="<?php echo JText::_('JS_NEWEST_JOBS'); ?>" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=listnewestjobs&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_NEWEST_JOBS'); ?>  </a>
									<?php echo '</td>'?>
							<?php } 
							 if ($this->jscontrolpanel['formcoverletter'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img align="left" width="24" height="24" src="components/com_wrecruit/images/new.png" alt="<?php echo JText::_('JS_ADD_COVER_LETTER'); ?>" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=formcoverletter&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_ADD_COVER_LETTER'); ?>  </a>
									<?php echo '</td>'?>
							<?php } ?>
							 <?php if ($this->jscontrolpanel['myappliedjobs'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img align="left" width="24" height="24" src="components/com_wrecruit/images/appliedjobs.png" alt="<?php echo JText::_('JS_MY_APPLIED_JOBS'); ?>" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=myappliedjobs&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_MY_APPLIED_JOBS'); ?>  </a>
									<?php echo '</td>'?>
							<?php } 
							if ($this->jscontrolpanel['mycoverletters'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img align="left" width="24" height="24" src="components/com_wrecruit/images/coverletter.png" alt="<?php echo JText::_('JS_MY_COVER_LETTERS'); ?>" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=mycoverletters&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_MY_COVER_LETTERS'); ?> </a> 
									<?php echo '</td>'?>
							<?php } 
							if ($this->jscontrolpanel['jobsearch'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img align="left" width="24" height="24" src="components/com_wrecruit/images/search.png" alt="<?php echo JText::_('JS_SEARCH_JOB'); ?>" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=jobsearch&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_SEARCH_JOB'); ?>  </a>
									<?php echo '</td>'?>
							<?php } 
							 if ($this->jscontrolpanel['jspackages'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									<img align="left" width="24" height="24" src="components/com_wrecruit/images/packages.png" alt=" Packages" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=packages&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_PACKAGES'); ?>  </a>
									<?php echo '</td>'?>
							<?php } 
							if ($this->jscontrolpanel['my_jobsearches'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img align="left" width="24" height="24" src="components/com_wrecruit/images/save.png" alt="<?php echo JText::_('JS_JOB_SAVE_SEARCHES'); ?>" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=my_jobsearches&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_JOB_SAVE_SEARCHES'); ?>  </a>
									<?php echo '</td>'?>
							<?php } 
							 if ($this->jscontrolpanel['jspurchasehistory'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img align="left" width="24" height="24" src="components/com_wrecruit/images/purchase_history.png" alt=" Employer Purchase History" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=purchasehistory&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_PURCHASE_HISTORY'); ?>  </a>
									<?php echo '</td>'?>
							<?php } 
							if ($this->jscontrolpanel['jsmy_stats'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img align="left" width="24" height="24" src="components/com_wrecruit/images/mystats.png" alt="My Stats" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=my_stats&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_MY_STATS'); ?>  </a>
									<?php echo '</td>'?>
							<?php } 
							 if ($this->jscontrolpanel['jobalertsetting'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img align="left" width="24" height="24" src="components/com_wrecruit/images/jobalert.png" alt="Job Alert" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=jobalertsetting&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_JOB_ALERT'); ?>  </a>
									<?php echo '</td>'?>
							<?php } 	
							if ($this->jscontrolpanel['jsmessages'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img align="left" width="24" height="24" src="components/com_wrecruit/images/messages.png" alt="Messages" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=jsmessages&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_MESSAGES'); ?>  </a>
									<?php echo '</td>'?>
							<?php } 
								for($i = $colcount; $i < $colperrow; $i++){
									echo '<td width="'.$colwidth.'"></td>';
								}
								echo '</tr>';
								$colcount=0;
								?>
							</table>	
						</td>		
					</tr>
					
			</table>	
			</td>
		</tr>	
		<tr>
			<td>
			</td>
		</tr>		
	</table>
<?php
} else{ // not allowed job posting
	//Update by Vireak on 09/08/2012
	//Add frame to this warning and some styling
	//---------------------
	echo '<div class="box-list"><div class="head-title"><h2>Oop!</h2></div>';
	echo '<span class="wr_info"><p>'.JText::_('JS_YOU_ARE_NOT_ALLOWED_TO_VIEW').'</p>';
	echo '<p>This page is reserved for the authorized candidates only. </p></span>';
	echo '</div>';
	//---------------------
}
}//ol
?>
<div width="100%">
<?php 
if($this->config['fr_cr_txsh']) {
	echo 
	'<table width="100%" style="table-layout:fixed;">
		<tr><td height="15"></td></tr>
		<tr><td style="vertical-align:top;" align="center">'.$this->config['fr_cr_txa'].$this->config['fr_cr_txb'].'</td></tr>
	</table>';
}	
?>
</div>

